package com.Extends.Second;

//老师和学生
public class Demo1 {
    public static void main(String[] args){
        //创建老师类对象并进行测试

        //无参
        Teacher t1 = new Teacher();
        t1.setName("张三");
        t1.setAge(30);
        System.out.println(t1.getName()+","+t1.getAge());
        t1.teach();
        //含参
        Teacher t2 = new Teacher("李四",45);
        System.out.println(t2.getName()+","+t2.getAge());
        t2.teach();

        //创建学生类对象并进行测试

        //无参
        Student s1 = new Student();
        s1.setName("张四");
        s1.setAge(10);
        System.out.println(s1.getName()+","+s1.getAge());
        s1.study();
        //含参
        Student S2 = new Student("李五",15);
        System.out.println(S2.getName()+","+S2.getAge());
        S2.study();
    }


}
